import {createRouter,createWebHashHistory }from 'vue-router'
 const routes=[
    {
        path:'/',
        component:()=>import('../views/Main.vue'),
        // 此为重定向属性，用处为在当没有的根路径时，默认显示该路径
        name:'home',
        redirect:'/home',
        children:[
            {
                path:'/home',
                name:'home',
                component:()=>import('../views/home/Home.vue')
            },
            {
                path:'/user',
                name:'user',
                component:()=>import('../views/User/User.vue')
            },
            {
                path:'/page1',
                name:'page1',
                component:()=>import('../views/Page1.vue')
            },
            {
                path:'/page2',
                name:'page2',
                component:()=>import('../views/Page2.vue')
            },
        ]
    },
    // 登录页面和首页整体同级别,同级别意味着将打开新的页面，就不是单页面网页了
    {
        path:'/login',
        component:()=>import('../views/Login.vue')
    }
 ]

 const router=createRouter({
    history:createWebHashHistory(),
    routes
 })

 export default router